package com.miniprogram.api.mapper;

import com.miniprogram.bean.po.CustomerPermission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 顾客权限表 Mapper 接口
 * </p>
 *
 * @author lin
 * @since 2020-04-06
 */
public interface CustomerPermissionMapper extends BaseMapper<CustomerPermission> {

    @Select("select p.* from customer_user u,customer_permission p,customer_role r,customer_role_permission rp,customer_user_role ur where u.id=ur.uid and ur.rid = r.id and r.id = rp.rid and rp.pid = p.id and u.id = #{userId}")
    List<CustomerPermission> findByUserId(Integer userId);
}
